package com.lyn.pluginbazaar.entity;

public class Result {

    public static final int SUCCESS = 1;
    public static final int FAIL = 0;
    public static final int NOT_LOGGED_IN=-1;

    private int code;

    private String msg;

    private Object data;

    public Result() {
    }

    public Result(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static Result SUCCESS() {
        return new Result(SUCCESS, "success", null);
    }

    public static Result SUCCESS(String msg) {
        return new Result(SUCCESS, msg, null);
    }

    public static Result SUCCESS(Object data) {
        return new Result(SUCCESS, "success", data);
    }

    public static Result SUCCESS(String msg, Object data) {
        return new Result(SUCCESS, msg, data);
    }

    public static Result FAIL() {
        return new Result(FAIL, "fail", null);
    }

    public static Result FAIL(String msg) {
        return new Result(FAIL, msg, null);
    }

    public static Result FAIL(Object data) {
        return new Result(FAIL, "fail", data);
    }

    public static Result FAIL(String msg, Object data) {
        return new Result(FAIL, msg, data);
    }


    public static Result NOT_LOGGED_IN(String msg){
        return new Result(NOT_LOGGED_IN,msg,null);
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
